//
//  LandmarkRow.swift
//  Landmarks
//
//  Created by XN on 2019/6/4.
//  Copyright © 2019 pc. All rights reserved.
//

import SwiftUI

struct LandmarkRow : View {
    var landmark: Landmark
    
    var body: some View {
        HStack {
            landmark.image(forSize: 50)
            
            VStack(alignment: .leading){
                Text(landmark.name)
                Text(landmark.state + "(\(landmark.category.rawValue))")
                    .font(.subheadline)
                    .foregroundStyle(.gray)
            }
            
            Spacer()
            
            if landmark.isFavorite == true {
                Image(systemName: "star.fill")
                    .foregroundColor(.yellow)
            }
        }
    }
}

#Preview {
    let landmarks = ModelData().landmarkData
    
    return Group{
        LandmarkRow(landmark: landmarks[0])
        LandmarkRow(landmark: landmarks[1])
    }
}
